/* 
 * File:   main.cpp
 * Author: Toya
 *
 * Created on 4 octobre 2012, 19:59
 */

#include <cstdlib>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>

using namespace std;


int n; // nb sommets
vector<vector<vector<int> > > G;

void initGraphe(){
   string s = "";int a;
    cout<<"Combien de sommets ?"<<endl<<">";
    cin>>n;
    
    for(int i=0;i<n;i++){ 
        G.push_back(vector<vector<int> >());
    }
    
    cout<<"indiquez vos aretes et finissez par 'fin'"<<endl;
     cout<<"i j flot capacité"<<endl; 
     
        cout<<">";
     getline (cin,s); 
    getline (cin,s); 
    s+=" ";
  
    int cpt=0;
    int c=0;
    string str="";
    while(s!="fin "){
         cpt=0;
         c=0;
         str="";
         int t[4];
        while(cpt<4 ){
           if(s[c]!=' '){
               str+=s[c];
               c++;  
           }
           else{
               
               istringstream iss(str);
               iss >> t[cpt];
               cpt++; 
               str="";
               c++;
           }
            
            
        }

        G[t[0]].push_back(vector<int>());
        G[t[0]][G[t[0]].size()-1].push_back(t[1]);
        G[t[0]][G[t[0]].size()-1].push_back(t[2]);
        G[t[0]][G[t[0]].size()-1].push_back(t[3]);
      //  a=atoi(s[0]);
      cout<<">";
           getline (cin,s); 
            s+=" ";
    }

}

void graphEcart(){
    
    
    
    

}


void pcChemin(){
    
    
    
    

}

void afficheGraphe(vector<vector<vector<int> > > g){
    
    for(int i=0;i<n;i++){
       
        cout<<i<<" relie a : ";
        
        for(int j=0;j<g[i].size();j++){
            
             cout<<g[i][j][0]<<" ("<<g[i][j][1]<<"/"<<g[i][j][2]<<") , ";
        
        }
    cout<<endl;
     }
 
}

/*
 * 
 */
int main(int argc, char** argv) {
    
initGraphe();
afficheGraphe(G);
   
    
    return 0;
}

